package com.entor.controller;

import com.entor.model.Orbit;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

import com.entor.util.Json;
import com.entor.sevice.OrbitServiceI;

/**
 * @author HQJ
 * @date 2017年10月31日
 */

@RequestMapping("/orbit")
@Controller
public class OrbitController extends BaseController<Orbit> {

	@Autowired
	private OrbitServiceI service;

	public List<Orbit> find(Orbit orbit) {
		List<Orbit> list = service.find(orbit);
		return list;
	}

	public String insert(Orbit orbit) {
		int i = service.insert(orbit);
		if (i > 0) {
			return "info/findPupil";
		} else
			return "error/500";
	}

	public Json update(Orbit orbit) {
		int i = service.update(orbit);
		return this.getJson(i, "更新");
	}

	public Json delete(HttpServletRequest request) {
		String id = request.getParameter("id");
		int i = service.delete(id);
		return this.getJson(i, "删除");
	}
	
	@RequestMapping("/findMap")
	@ResponseBody
	public List<List<Orbit>> findMap(Orbit t){
		return service.findMap(t);
	}

}